class Logo{
    constructor(ops){
        this.url=ops.url;
        this.cont=ops.cont;
        this.load()
    }
    load(){
        request({
            url:this.url,
            success:(res)=>{
                this.res=JSON.parse(res)
                this.render()
            }
        })
    }
    render(){
        let str="";
        for(var i=0;i<this.res.length;i++){
            str+=` 
            <li index="${this.res[i].proId}">
                <div class="schan1">
                    <img src="${this.res[i].url}" alt="">
                </div>
                <h3>${this.res[i].name}
                </h3>
                <div class="schan2">
                    <div class="schan21">
                        <span>总销量:</span>
                        <strong>${this.res[i].xiaoliang}</strong>
                    </div>
                    <div class="schan22">
                        <span>¥</span>
                        <strong>${this.res[i].price}</strong>
                    </div>
                    <span class="iconfont icon-gouwuche"></span>
                </div>
            </li>
        `
        }
        this.cont.innerHTML=str;
    }
}
new Logo({
    cont:document.querySelector(".zuiniu"),
    url:"./data/data.json"
})